import request from './request'

export const memoryApi = {
  // 获取进程内存信息
  getProcesses(productName, version) {
    return request.get(`/products/${productName}/${version}/processes`)
  },

  // 获取进程详情
  getProcessDetails(productName, version, processId, type = 'details') {
    return request.get(`/products/${productName}/${version}/processes/${processId}/objects`, {
      params: { type }
    })
  },

  // 获取进程的VMA信息
  getProcessVmas(productName, version, processId) {
    return request.get(`/products/${productName}/${version}/processes/${processId}/vmas`, {
      params: { type: 'process' }
    })
  },

  // 获取进程的线程信息
  getProcessThreads(productName, version, processId) {
    return request.get(`/products/${productName}/${version}/processes/${processId}/threads`)
  },

  // 获取对象内存信息
  getObjects(productName, version) {
    return request.get(`/products/${productName}/${version}/objects`)
  },

  // 获取对象详情
  getObjectDetails(productName, version, objectId) {
    return request.get(`/products/${productName}/${version}/objects/${objectId}/processes`)
  },

  // 获取内存统计信息
  getMemoryStats(productName, version) {
    return request.get(`/products/${productName}/${version}/processes`, {
      params: { details: true }
    })
  }
}